function reallocReactType(p,n)
  use derived,only:ReactionType
  implicit none

  type(ReactionType),pointer,dimension(:) :: &
       reallocReactType,p
  integer,intent(in) :: n

  integer :: i,j,k
  integer :: ierr,nd,nn

  allocate(reallocReactType(1:n),stat=ierr)
  if (ierr.ne.0) call abnormal_stop("reallocReactType",&
       "Memory allocation causes an error.")

  do i=1,n
     reallocReactType(i)%obj1=0
     reallocReactType(i)%obj2=0
     reallocReactType(i)%n_data=0
     reallocReactType(i)%n_react_group=0
     nullify(reallocReactType(i)%react_eb)
     nullify(reallocReactType(i)%react_nu)
     nullify(reallocReactType(i)%react_rd)
     nullify(reallocReactType(i)%react_rd2)
     nullify(reallocReactType(i)%react_const_rate)
     nullify(reallocReactType(i)%n_new)
     nullify(reallocReactType(i)%new)
     nullify(reallocReactType(i)%react_group)
  end do

  if (.not.associated(p)) return

  do i=1,n-1
     reallocReactType(i)%obj1=p(i)%obj1
     reallocReactType(i)%obj2=p(i)%obj2
     reallocReactType(i)%n_data=p(i)%n_data
     nd=p(i)%n_data
     allocate(reallocReactType(i)%react_eb(nd))
     allocate(reallocReactType(i)%react_nu(nd))
     allocate(reallocReactType(i)%react_rd(nd))
     allocate(reallocReactType(i)%react_rd2(nd))
     allocate(reallocReactType(i)%react_const_rate(nd))
     allocate(reallocReactType(i)%n_new(nd))
     allocate(reallocReactType(i)%new(nd))
     do j=1,nd
        reallocReactType(i)%react_eb(j)=p(i)%react_eb(j)
        reallocReactType(i)%react_nu(j)=p(i)%react_nu(j)
        reallocReactType(i)%react_rd(j)=p(i)%react_rd(j)
        reallocReactType(i)%react_rd2(j)=p(i)%react_rd2(j)
        reallocReactType(i)%react_const_rate(j)=&
             p(i)%react_const_rate(j)
        reallocReactType(i)%n_new(j)=p(i)%n_new(j)
        nn=p(i)%n_new(j)
        if (nn.gt.0) then
           allocate(reallocReactType(i)%new(j)%prod_type(nn))
           do k=1,nn
              reallocReactType(i)%new(j)%prod_type(k)=&
                   p(i)%new(j)%prod_type(k)
           end do
           deallocate(p(i)%new(j)%prod_type)
        end if
     end do
     deallocate(p(i)%react_eb)
     deallocate(p(i)%react_nu)
     deallocate(p(i)%react_rd)
     deallocate(p(i)%react_rd2)
     deallocate(p(i)%react_const_rate)
     deallocate(p(i)%n_new)
     deallocate(p(i)%new)
  end do

  deallocate(p)

  return

end function reallocReactType
